@echo off
rem 创建数据库表的简化版本

rem 删除表（如果存在）
mysql -uroot -proot zjcloudtest -e "DROP TABLE IF EXISTS jwgl_school_info;"
if %errorlevel% neq 0 (echo 删除表失败 & exit /b 1)

echo 删除表成功！

rem 创建表结构
mysql -uroot -proot zjcloudtest -e "CREATE TABLE jwgl_school_info (school_id bigint NOT NULL AUTO_INCREMENT, school_name varchar(255) NOT NULL, school_code varchar(50) NOT NULL, current_semester varchar(50) DEFAULT NULL, status varchar(1) DEFAULT '0', PRIMARY KEY (school_id)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"
if %errorlevel% neq 0 (echo 创建表失败 & exit /b 1)

echo 创建表成功！

rem 插入测试数据
mysql -uroot -proot zjcloudtest -e "INSERT INTO jwgl_school_info (school_name, school_code, status) VALUES ('智教云示范中学', 'ZJYZX', '0'), ('智能技术学院', 'ZNJSC', '0');"
if %errorlevel% neq 0 (echo 插入数据失败 & exit /b 1)

echo 数据插入成功！
echo 数据库表创建完成！